﻿using System;
using Business;

namespace TimeWork
{
    public partial class ListProject : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["email"] == null)
            {
                Response.Redirect("http://"+Request.Url.Authority+"/Login.aspx");
            }
            if (!IsPostBack)
            {
                LoadGrid();
            }
        }

        public void LoadGrid()
        {
            GvListProject.DataSource = BuProject.selAllProject(false, Session["companyid"].ToString());
            GvListProject.DataBind();
        }

        protected void cbHideProject_CheckedChanged(object sender, EventArgs e)
        {
            GvListProject.DataSource = BuProject.selAllProject(cbHideProject.Checked, Session["companyid"].ToString());
            GvListProject.DataBind();
        }

        protected void btnCreate_Click(object sender, EventArgs e)
        {
            Response.Redirect("ViewProject.aspx");
        }
    }
}